<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="{{=T.accepted_language or 'en'}}">
<head>
<title>Grafter</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
{{include 'web2py_ajax.html'}}
<script type="text/javascript" src="{{=URL(request.application,'static','raphael.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','jquery.autoSuggest.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','jquery-ui-1.8.1.custom.min.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','grafterGlobals.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','config.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','util.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','grafterUtil.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','shadowboxUtil.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','shadowbox.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','elementSort.js')}}"></script>
<script type="text/javascript" src="{{=URL(request.application,'static','farbtastic.js')}}"></script>
<link rel="stylesheet" media="screen,projection" type="text/css" href="{{=URL(request.application,'static','shadowbox.css')}}" />
<link rel="stylesheet" media="screen,projection" type="text/css" href="{{=URL(request.application,'static','custom.css')}}" />
<link rel="stylesheet" media="screen,projection" type="text/css" href="{{=URL(request.application,'static','autoSuggest.css')}}" />
<link rel="stylesheet" media="screen,projection" type="text/css" href="{{=URL(request.application,'static','jquery-ui-1.8.1.custom.css')}}" />
<link rel="stylesheet" media="screen,projection" type="text/css" href="{{=URL(request.application,'static','farbtastic.css')}}" />
</head>
<body oncontextmenu="return false;">

    <script type="text/javascript">
        Shadowbox.init( { enableKeys: false, modal: false } );
    </script>

    <div id="mainPanel" class="blackBorder scrollable fullWidth fullHeight">
        <div id="raphaelContainer"></div>
    </div>

    <script type="text/javascript" charset="utf-8">

        {{for id in trees.keys():}}
            globals.grafterTrees[{{=id}}] = { tree: {{=trees[id]}}, treeInfo: { }, path: null, id: {{=id}}, labels: { } };
        {{pass}}

       grafterInitialize(); 

       for each( var tree in globals.grafterTrees ) {
           tree.path = drawCladogram2( { clade: tree.tree, generation: tree.treeInfo.generations, isRoot: true, labels: tree.labels } );
           tree.path.node.id = tree.id;
           globals.currentTip.y = globals.currentTip.y + 50;
           tree.path.mousedown(
            function(e) {
                globals.currentEvents.mouseDownPath = this.node.id;
                globals.currentEvents.mouseCoords = { x: e.pageX, y: e.pageY };
            } );
       }
           
       window.onload = function () {

           $('#raphaelContainer').mouseup( function() { globals.currentEvents.mouseDownPath = false; } );
           $('#raphaelContainer').mousemove( function(e) { if( globals.currentEvents.mouseDownPath ) { handlePathDrag( { tree: globals.grafterTrees[globals.currentEvents.mouseDownPath], e: e } ); } } );

       }

    </script>


  </body>
</html>

              
